<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld"    prefix="vectrics" %>

<%@page import="org.vectrics.recruiter.RecruitServiceLocator"%>
<%@page import="org.vectrics.recruiter.document.CandidateDocumentCategory"%>
<%@page import="java.util.List"%>

<%

	String personId = request.getParameter("personId");
    if (personId == null) {
    	personId = request.getParameter("idPerson");
    }
    // Busco todas las categorias de archivos
    List <CandidateDocumentCategory> categorias = RecruitServiceLocator.getRecruitUserService().findAllCandidateDocumentCategories();
    
    // Lleno la descripcion con el codigo internacionalizado
    for (CandidateDocumentCategory categoria : categorias) {
    	categoria.setDescription(categoria.getDescription(request.getLocale()));
    }
    
    // Seteo las categorias 
    request.setAttribute("categorys", categorias);
    
%>

<jsp:useBean id="fileForm" 
	class="org.vectrics.recruiter.struts.admin.file.FileForm" scope="request"/>

	<table>
		<tr>
			<td valign="top">
				<vectrics:candidateDocuments personId="<%=personId%>" showRemove="true"  />
			</td>
			<td valign="top" align="right">
				<table cellpadding="0" cellspacing="0">

					<tr>
						<td>
							<form action="/hrs-intranet/admin/user/view.do" method="POST">
								<input type="hidden" name="userId" value="<%=personId%>">
								<vectrics:formButton code="button.param" phraseCode="button.candidate.view.person" 
									elementId="view.person.id"
									value="submit" name="submit"/>
							</form>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
<br />
   <table>
        <tr>
           <td>
            <vectrics:errors />
			<h3><bean:message key="prompt.file.upload" /></h3>
			<html:form action="/admin/user/docs/upload" focus="name" method="post" enctype="multipart/form-data" >
				
				<html:hidden property="idPerson" value="<%=personId%>" />
				
                <table cellspacing="0" cellspacing="0" >
					<tr>
						<td>
							<span class="subFont"><bean:message key="prompt.person.resume.name" />: </span>
                        </td>
                        <td>    
                            <html:text property="name" styleClass="formEditClass" maxlength="60"/>&nbsp;
						</td>
                   </tr>
                   <tr>
                       <td>
                           <span class="subFont"><bean:message key="prompt.person.resume.category" />: </span>
                       </td>
                        <td>
	                    <html:select property="category" styleClass="formComboCategory">
							<html:options collection="categorys" labelProperty="description" property="code"/>
						</html:select>
                      </td>
                   </tr>
                   <tr>
						<td>
							<span class="subFont"><bean:message key="prompt.person.resume.file" />: </span>
                         </td>
                         <td>   
                            <html:file  property="theFile"  />
						</td>
					</tr>
					<tr>
						<td colspan="2"><br/>
							<vectrics:formButton elementId="resume.upload.btn" code="button.param" phraseCode="button.resume.upload" value="submit" name="submit"/>
						</td>
					</tr>
				</table>
			</html:form>
           </td>
        </tr>
</table>
	